﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CONTROLADORA;

namespace VISTA
{
    public partial class frmAdmPermisos : FormAdminBase
    {

        Permisos controladora = new Permisos();

        public frmAdmPermisos()
        {
            InitializeComponent();
        }

        private void btnBuscar_Click(object sender, EventArgs e)
        {
            base.EjecutarAccion(AccionADM.Buscar);
        }

        private void btnSal_Click(object sender, EventArgs e)
        {
            this.Close();
        }



        protected override void BuscarEntidadesConsulta()
        {
            this.grdConsulta.DataSource = controladora.GetPermisos(this.txtNombre.Text).ConsultaPermisos;
        }

        protected override void ShowFormABM(ModoABM modo, int id)
        {
            VISTA.frmABMPermisos frm = new VISTA.frmABMPermisos(modo, id);
            frm.ShowDialog(this);
        }

        protected override int GetEntidadSeleccionada()
        {
            if (this.grdConsulta.SelectedRows.Count != 0)
            {
                return (int)this.grdConsulta.SelectedRows[0].Cells[0].Value;
            }
            return -1;
        }



        private void btnAlta_Click(object sender, EventArgs e)
        {
            base.EjecutarAccion(AccionADM.DarDeAlta);
        }

        private void btnModificar_Click(object sender, EventArgs e)
        {
            base.EjecutarAccion(AccionADM.Modificar);
        }

        private void btnConsultar_Click(object sender, EventArgs e)
        {
            base.EjecutarAccion(AccionADM.Consultar);
        }

        private void btnEliminar_Click(object sender, EventArgs e)
        {
            base.EjecutarAccion(AccionADM.Eliminar);
        }


    }
}